3.44 \(\int \frac {\tan ^3(c+d x) (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^2} \, dx\)

Optimal. Leaf size=142 \[ \frac {(A+2 i B) \tan ^2(c+d x)}{2 a^2 d (1+i \tan (c+d x))}+\frac {3 (-3 B+i A) \tan (c+d x)}{4 a^2 d}+\frac {(A+2 i B) \log (\cos (c+d x))}{a^2 d}-\frac {3 x (-3 B+i A)}{4 a^2}+\frac {(-B+i A) \tan ^3(c+d x)}{4 d (a+i a \tan (c+d x))^2} \]

[Out]

-3/4*(I*A-3*B)*x/a^2+(A+2*I*B)*ln(cos(d*x+c))/a^2/d+3/4*(I*A-3*B)*tan(d*x+c)/a^2/d+1/2*(A+2*I*B)*tan(d*x+c)^2/
a^2/d/(1+I*tan(d*x+c))+1/4*(I*A-B)*tan(d*x+c)^3/d/(a+I*a*tan(d*x+c))^2

________________________________________________________________________________________

Rubi [A]  time = 0.28, antiderivative size = 142, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 34, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.088, Rules used = {3595, 3525, 3475} \[ \frac {(A+2 i B) \tan ^2(c+d x)}{2 a^2 d (1+i \tan (c+d x))}+\frac {3 (-3 B+i A) \tan (c+d x)}{4 a^2 d}+\frac {(A+2 i B) \log (\cos (c+d x))}{a^2 d}-\frac {3 x (-3 B+i A)}{4 a^2}+\frac {(-B+i A) \tan ^3(c+d x)}{4 d (a+i a \tan (c+d x))^2} \]

Antiderivative was successfully verified.

[In]

Int[(Tan[c + d*x]^3*(A + B*Tan[c + d*x]))/(a + I*a*Tan[c + d*x])^2,x]

[Out]

(-3*(I*A - 3*B)*x)/(4*a^2) + ((A + (2*I)*B)*Log[Cos[c + d*x]])/(a^2*d) + (3*(I*A - 3*B)*Tan[c + d*x])/(4*a^2*d
) + ((A + (2*I)*B)*Tan[c + d*x]^2)/(2*a^2*d*(1 + I*Tan[c + d*x])) + ((I*A - B)*Tan[c + d*x]^3)/(4*d*(a + I*a*T
an[c + d*x])^2)

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3525

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[(b*d*Tan[e + f*x])/f, x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rule 3595

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_), x_Symbol] :> -Simp[((A*b - a*B)*(a + b*Tan[e + f*x])^m*(c + d*Tan[e + f*x])^n)/(2*a*f*
m), x] + Dist[1/(2*a^2*m), Int[(a + b*Tan[e + f*x])^(m + 1)*(c + d*Tan[e + f*x])^(n - 1)*Simp[A*(a*c*m + b*d*n
) - B*(b*c*m + a*d*n) - d*(b*B*(m - n) - a*A*(m + n))*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, A,
B}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && LtQ[m, 0] && GtQ[n, 0]

Rubi steps

\begin {align*} \int \frac {\tan ^3(c+d x) (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^2} \, dx &=\frac {(i A-B) \tan ^3(c+d x)}{4 d (a+i a \tan (c+d x))^2}-\frac {\int \frac {\tan ^2(c+d x) (3 a (i A-B)+a (A+5 i B) \tan (c+d x))}{a+i a \tan (c+d x)} \, dx}{4 a^2}\\ &=\frac {(A+2 i B) \tan ^2(c+d x)}{2 a^2 d (1+i \tan (c+d x))}+\frac {(i A-B) \tan ^3(c+d x)}{4 d (a+i a \tan (c+d x))^2}+\frac {\int \tan (c+d x) \left (-8 a^2 (A+2 i B)+6 a^2 (i A-3 B) \tan (c+d x)\right ) \, dx}{8 a^4}\\ &=-\frac {3 (i A-3 B) x}{4 a^2}+\frac {3 (i A-3 B) \tan (c+d x)}{4 a^2 d}+\frac {(A+2 i B) \tan ^2(c+d x)}{2 a^2 d (1+i \tan (c+d x))}+\frac {(i A-B) \tan ^3(c+d x)}{4 d (a+i a \tan (c+d x))^2}-\frac {(A+2 i B) \int \tan (c+d x) \, dx}{a^2}\\ &=-\frac {3 (i A-3 B) x}{4 a^2}+\frac {(A+2 i B) \log (\cos (c+d x))}{a^2 d}+\frac {3 (i A-3 B) \tan (c+d x)}{4 a^2 d}+\frac {(A+2 i B) \tan ^2(c+d x)}{2 a^2 d (1+i \tan (c+d x))}+\frac {(i A-B) \tan ^3(c+d x)}{4 d (a+i a \tan (c+d x))^2}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B]  time = 7.09, size = 956, normalized size = 6.73 \[ \frac {i \sec (c) \sec ^2(c+d x) (-B \cos (2 c-d x)+B \cos (2 c+d x)-i B \sin (2 c-d x)+i B \sin (2 c+d x)) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^2}{2 d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^2}+\frac {x \sec (c+d x) (-\tan (c) A+i A-2 B-2 i B \tan (c)+(A+2 i B) (-\cos (2 c)-i \sin (2 c)) \tan (c)) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^2}{(A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^2}-\frac {(2 A+3 i B) \cos (2 d x) \sec (c+d x) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^2}{4 d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^2}+\frac {\sec (c+d x) (A \cos (c)+2 i B \cos (c)+i A \sin (c)-2 B \sin (c)) \left (\tan ^{-1}(\tan (d x)) \sin (c)-i \tan ^{-1}(\tan (d x)) \cos (c)\right ) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^2}{d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^2}+\frac {\sec (c+d x) (A \cos (c)+2 i B \cos (c)+i A \sin (c)-2 B \sin (c)) \left (\frac {1}{2} \cos (c) \log \left (\cos ^2(c+d x)\right )+\frac {1}{2} i \sin (c) \log \left (\cos ^2(c+d x)\right )\right ) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^2}{d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^2}+\frac {(A+i B) \cos (4 d x) \sec (c+d x) \left (\frac {1}{16} \cos (2 c)-\frac {1}{16} i \sin (2 c)\right ) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^2}{d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^2}+\frac {(3 B-i A) \sec (c+d x) \left (\frac {3}{4} d x \cos (2 c)+\frac {3}{4} i d x \sin (2 c)\right ) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^2}{d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^2}+\frac {i (2 A+3 i B) \sec (c+d x) \sin (2 d x) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^2}{4 d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^2}+\frac {(B-i A) \sec (c+d x) \left (\frac {1}{16} \cos (2 c)-\frac {1}{16} i \sin (2 c)\right ) \sin (4 d x) (A+B \tan (c+d x)) (\cos (d x)+i \sin (d x))^2}{d (A \cos (c+d x)+B \sin (c+d x)) (i \tan (c+d x) a+a)^2} \]

Antiderivative was successfully verified.

[In]

Integrate[(Tan[c + d*x]^3*(A + B*Tan[c + d*x]))/(a + I*a*Tan[c + d*x])^2,x]

[Out]

-1/4*((2*A + (3*I)*B)*Cos[2*d*x]*Sec[c + d*x]*(Cos[d*x] + I*Sin[d*x])^2*(A + B*Tan[c + d*x]))/(d*(A*Cos[c + d*
x] + B*Sin[c + d*x])*(a + I*a*Tan[c + d*x])^2) + (Sec[c + d*x]*(A*Cos[c] + (2*I)*B*Cos[c] + I*A*Sin[c] - 2*B*S
in[c])*((-I)*ArcTan[Tan[d*x]]*Cos[c] + ArcTan[Tan[d*x]]*Sin[c])*(Cos[d*x] + I*Sin[d*x])^2*(A + B*Tan[c + d*x])
)/(d*(A*Cos[c + d*x] + B*Sin[c + d*x])*(a + I*a*Tan[c + d*x])^2) + (Sec[c + d*x]*(A*Cos[c] + (2*I)*B*Cos[c] +
I*A*Sin[c] - 2*B*Sin[c])*((Cos[c]*Log[Cos[c + d*x]^2])/2 + (I/2)*Log[Cos[c + d*x]^2]*Sin[c])*(Cos[d*x] + I*Sin
[d*x])^2*(A + B*Tan[c + d*x]))/(d*(A*Cos[c + d*x] + B*Sin[c + d*x])*(a + I*a*Tan[c + d*x])^2) + ((A + I*B)*Cos
[4*d*x]*Sec[c + d*x]*(Cos[2*c]/16 - (I/16)*Sin[2*c])*(Cos[d*x] + I*Sin[d*x])^2*(A + B*Tan[c + d*x]))/(d*(A*Cos
[c + d*x] + B*Sin[c + d*x])*(a + I*a*Tan[c + d*x])^2) + (((-I)*A + 3*B)*Sec[c + d*x]*((3*d*x*Cos[2*c])/4 + ((3
*I)/4)*d*x*Sin[2*c])*(Cos[d*x] + I*Sin[d*x])^2*(A + B*Tan[c + d*x]))/(d*(A*Cos[c + d*x] + B*Sin[c + d*x])*(a +
 I*a*Tan[c + d*x])^2) + ((I/4)*(2*A + (3*I)*B)*Sec[c + d*x]*(Cos[d*x] + I*Sin[d*x])^2*Sin[2*d*x]*(A + B*Tan[c
+ d*x]))/(d*(A*Cos[c + d*x] + B*Sin[c + d*x])*(a + I*a*Tan[c + d*x])^2) + (((-I)*A + B)*Sec[c + d*x]*(Cos[2*c]
/16 - (I/16)*Sin[2*c])*(Cos[d*x] + I*Sin[d*x])^2*Sin[4*d*x]*(A + B*Tan[c + d*x]))/(d*(A*Cos[c + d*x] + B*Sin[c
 + d*x])*(a + I*a*Tan[c + d*x])^2) + ((I/2)*Sec[c]*Sec[c + d*x]^2*(Cos[d*x] + I*Sin[d*x])^2*(-(B*Cos[2*c - d*x
]) + B*Cos[2*c + d*x] - I*B*Sin[2*c - d*x] + I*B*Sin[2*c + d*x])*(A + B*Tan[c + d*x]))/(d*(A*Cos[c + d*x] + B*
Sin[c + d*x])*(a + I*a*Tan[c + d*x])^2) + (x*Sec[c + d*x]*(Cos[d*x] + I*Sin[d*x])^2*(I*A - 2*B - A*Tan[c] - (2
*I)*B*Tan[c] + (A + (2*I)*B)*(-Cos[2*c] - I*Sin[2*c])*Tan[c])*(A + B*Tan[c + d*x]))/((A*Cos[c + d*x] + B*Sin[c
 + d*x])*(a + I*a*Tan[c + d*x])^2)

________________________________________________________________________________________

fricas [A]  time = 0.52, size = 147, normalized size = 1.04 \[ \frac {{\left (-28 i \, A + 68 \, B\right )} d x e^{\left (6 i \, d x + 6 i \, c\right )} + {\left ({\left (-28 i \, A + 68 \, B\right )} d x - 8 \, A - 44 i \, B\right )} e^{\left (4 i \, d x + 4 i \, c\right )} - {\left (7 \, A + 11 i \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )} + 16 \, {\left ({\left (A + 2 i \, B\right )} e^{\left (6 i \, d x + 6 i \, c\right )} + {\left (A + 2 i \, B\right )} e^{\left (4 i \, d x + 4 i \, c\right )}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + A + i \, B}{16 \, {\left (a^{2} d e^{\left (6 i \, d x + 6 i \, c\right )} + a^{2} d e^{\left (4 i \, d x + 4 i \, c\right )}\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^3*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^2,x, algorithm="fricas")

[Out]

1/16*((-28*I*A + 68*B)*d*x*e^(6*I*d*x + 6*I*c) + ((-28*I*A + 68*B)*d*x - 8*A - 44*I*B)*e^(4*I*d*x + 4*I*c) - (
7*A + 11*I*B)*e^(2*I*d*x + 2*I*c) + 16*((A + 2*I*B)*e^(6*I*d*x + 6*I*c) + (A + 2*I*B)*e^(4*I*d*x + 4*I*c))*log
(e^(2*I*d*x + 2*I*c) + 1) + A + I*B)/(a^2*d*e^(6*I*d*x + 6*I*c) + a^2*d*e^(4*I*d*x + 4*I*c))

________________________________________________________________________________________

giac [A]  time = 1.09, size = 120, normalized size = 0.85 \[ -\frac {\frac {2 \, {\left (A - i \, B\right )} \log \left (\tan \left (d x + c\right ) + i\right )}{a^{2}} + \frac {2 \, {\left (7 \, A + 17 i \, B\right )} \log \left (\tan \left (d x + c\right ) - i\right )}{a^{2}} + \frac {16 \, B \tan \left (d x + c\right )}{a^{2}} - \frac {21 \, A \tan \left (d x + c\right )^{2} + 51 i \, B \tan \left (d x + c\right )^{2} - 22 i \, A \tan \left (d x + c\right ) + 74 \, B \tan \left (d x + c\right ) - 5 \, A - 27 i \, B}{a^{2} {\left (\tan \left (d x + c\right ) - i\right )}^{2}}}{16 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^3*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^2,x, algorithm="giac")

[Out]

-1/16*(2*(A - I*B)*log(tan(d*x + c) + I)/a^2 + 2*(7*A + 17*I*B)*log(tan(d*x + c) - I)/a^2 + 16*B*tan(d*x + c)/
a^2 - (21*A*tan(d*x + c)^2 + 51*I*B*tan(d*x + c)^2 - 22*I*A*tan(d*x + c) + 74*B*tan(d*x + c) - 5*A - 27*I*B)/(
a^2*(tan(d*x + c) - I)^2))/d

________________________________________________________________________________________

maple [A]  time = 0.19, size = 177, normalized size = 1.25 \[ -\frac {B \tan \left (d x +c \right )}{d \,a^{2}}-\frac {A \ln \left (\tan \left (d x +c \right )+i\right )}{8 d \,a^{2}}+\frac {i B \ln \left (\tan \left (d x +c \right )+i\right )}{8 d \,a^{2}}-\frac {A}{4 d \,a^{2} \left (\tan \left (d x +c \right )-i\right )^{2}}-\frac {i B}{4 d \,a^{2} \left (\tan \left (d x +c \right )-i\right )^{2}}+\frac {5 i A}{4 d \,a^{2} \left (\tan \left (d x +c \right )-i\right )}-\frac {7 B}{4 d \,a^{2} \left (\tan \left (d x +c \right )-i\right )}-\frac {7 \ln \left (\tan \left (d x +c \right )-i\right ) A}{8 d \,a^{2}}-\frac {17 i \ln \left (\tan \left (d x +c \right )-i\right ) B}{8 d \,a^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(d*x+c)^3*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^2,x)

[Out]

-1/d/a^2*B*tan(d*x+c)-1/8/d/a^2*A*ln(tan(d*x+c)+I)+1/8*I/d/a^2*B*ln(tan(d*x+c)+I)-1/4/d/a^2/(tan(d*x+c)-I)^2*A
-1/4*I/d/a^2/(tan(d*x+c)-I)^2*B+5/4*I/d/a^2/(tan(d*x+c)-I)*A-7/4/d/a^2/(tan(d*x+c)-I)*B-7/8/d/a^2*ln(tan(d*x+c
)-I)*A-17/8*I/d/a^2*ln(tan(d*x+c)-I)*B

________________________________________________________________________________________

maxima [F(-2)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: RuntimeError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^3*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^2,x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: Error executing code in Maxima: expt: undefined: 0 to a negative e
xponent.

________________________________________________________________________________________

mupad [B]  time = 6.41, size = 141, normalized size = 0.99 \[ \frac {\frac {\left (A+B\,2{}\mathrm {i}\right )\,1{}\mathrm {i}}{a^2}+\frac {B}{2\,a^2}-\mathrm {tan}\left (c+d\,x\right )\,\left (\frac {5\,\left (A+B\,2{}\mathrm {i}\right )}{4\,a^2}-\frac {B\,3{}\mathrm {i}}{4\,a^2}\right )}{d\,\left ({\mathrm {tan}\left (c+d\,x\right )}^2\,1{}\mathrm {i}+2\,\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B+A\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{8\,a^2\,d}-\frac {B\,\mathrm {tan}\left (c+d\,x\right )}{a^2\,d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (7\,A+B\,17{}\mathrm {i}\right )}{8\,a^2\,d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((tan(c + d*x)^3*(A + B*tan(c + d*x)))/(a + a*tan(c + d*x)*1i)^2,x)

[Out]

(((A + B*2i)*1i)/a^2 + B/(2*a^2) - tan(c + d*x)*((5*(A + B*2i))/(4*a^2) - (B*3i)/(4*a^2)))/(d*(2*tan(c + d*x)
+ tan(c + d*x)^2*1i - 1i)) + (log(tan(c + d*x) + 1i)*(A*1i + B)*1i)/(8*a^2*d) - (B*tan(c + d*x))/(a^2*d) - (lo
g(tan(c + d*x) - 1i)*(7*A + B*17i))/(8*a^2*d)

________________________________________________________________________________________

sympy [A]  time = 0.98, size = 267, normalized size = 1.88 \[ \frac {2 i B}{- a^{2} d e^{2 i c} e^{2 i d x} - a^{2} d} + \begin {cases} \frac {\left (\left (4 A a^{2} d e^{2 i c} + 4 i B a^{2} d e^{2 i c}\right ) e^{- 4 i d x} + \left (- 32 A a^{2} d e^{4 i c} - 48 i B a^{2} d e^{4 i c}\right ) e^{- 2 i d x}\right ) e^{- 6 i c}}{64 a^{4} d^{2}} & \text {for}\: 64 a^{4} d^{2} e^{6 i c} \neq 0 \\x \left (- \frac {- 7 i A + 17 B}{4 a^{2}} - \frac {\left (7 i A e^{4 i c} - 4 i A e^{2 i c} + i A - 17 B e^{4 i c} + 6 B e^{2 i c} - B\right ) e^{- 4 i c}}{4 a^{2}}\right ) & \text {otherwise} \end {cases} - \frac {x \left (7 i A - 17 B\right )}{4 a^{2}} + \frac {\left (A + 2 i B\right ) \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{a^{2} d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)**3*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))**2,x)

[Out]

2*I*B/(-a**2*d*exp(2*I*c)*exp(2*I*d*x) - a**2*d) + Piecewise((((4*A*a**2*d*exp(2*I*c) + 4*I*B*a**2*d*exp(2*I*c
))*exp(-4*I*d*x) + (-32*A*a**2*d*exp(4*I*c) - 48*I*B*a**2*d*exp(4*I*c))*exp(-2*I*d*x))*exp(-6*I*c)/(64*a**4*d*
*2), Ne(64*a**4*d**2*exp(6*I*c), 0)), (x*(-(-7*I*A + 17*B)/(4*a**2) - (7*I*A*exp(4*I*c) - 4*I*A*exp(2*I*c) + I
*A - 17*B*exp(4*I*c) + 6*B*exp(2*I*c) - B)*exp(-4*I*c)/(4*a**2)), True)) - x*(7*I*A - 17*B)/(4*a**2) + (A + 2*
I*B)*log(exp(2*I*d*x) + exp(-2*I*c))/(a**2*d)

________________________________________________________________________________________